package com.bbex.service.impl;

import com.bbex.entity.DepositHidAddress;
import com.bbex.mapper.DepositHidAddressDao;
import com.bbex.service.DepositHidAddressService;
import com.bbex.util.SnowFlake;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class DepositHidAddressServiceImpl implements DepositHidAddressService {

    @Autowired
    private DepositHidAddressDao depositHidAddressDao;

    @Override
    public String save(DepositHidAddress withdrawAddress) {
        String id = SnowFlake.createSnowFlake().nextIdString();
        withdrawAddress.setStatus(0);
        withdrawAddress.setCreateDate(LocalDateTime.now());
        withdrawAddress.setUpdateDate(LocalDateTime.now());
        withdrawAddress.setId(id);
        depositHidAddressDao.insert(withdrawAddress);
        return id;
    }

    @Override
    public void updateById(DepositHidAddress depositAddress) {
    }

    @Override
    public DepositHidAddress findByUserIdAndCoinId(String userId, String coinId) {
        return depositHidAddressDao.findByUserIdAndCoinId(userId, coinId);
    }

    @Override
    public DepositHidAddress findById(String id) {
        return depositHidAddressDao.findById(id);
    }


}
